<template>
  <!-- tabbar -->
  <div class="tabbar">
    <router-link
      v-for="item in obj"
      :key="item.id"
      :class="{active:false}"
      :to="item.url"
    >
      <i
        class="iconfont icon-item"
        :class="item.icons"
      />
      <span>{{ item.text }}</span>
    </router-link>
  </div>
</template>

<script setup name="Tabbar">
import { onMounted, ref } from 'vue'
import { tabbarInfo } from '@/api/public.js'

// 声明变量
const obj = ref([])

// 请求数据
onMounted(async () => {
  const result = await tabbarInfo()
  if (result.code === 200) {
    obj.value = result.data
  }
})
</script>

<style lang="less" scoped>
.tabbar{
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50px;
  display: flex;
  justify-content: space-around;
  align-items:center;
  border-top: 1px solid rgba(0, 0, 0, 0.2);
  background-color: #fff;
  z-index: 999;
  box-sizing: border-box;
  a{
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding-top: 6px;
    position: relative;
    color: #8B658B;
    &:nth-child(3)  .icon-item{
      position: absolute;
      top: -25px;
      width: 50px;
      height: 50px;
      font-size: 45px;
      text-align: center;
      line-height: 50px;
      background-color: #fff;
      border: 1px solid rgba(0, 0, 0, 0.2);
      border-radius: 50%;
    }
    &:nth-child(3)  span{
      height: 98%;
      display: flex;
      flex-direction: column;
      justify-content: end;
    }
 .icon-item{
    font-size: 25px;
    }
    span{
      font-size: 12px;
    }
  }
}
a.active{
  color:#FF1493;
}
</style>
